/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.gym.manager.interfaz;

import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Item;
import javax.microedition.lcdui.ItemCommandListener;
import javax.microedition.lcdui.List;

/**
 *
 * @author Sergio
 */
public class OpcionesManejoRutina extends Form implements CommandListener
{
    private MIDletGymManager principal;
    private ChoiceGroup opciones;
    private Command seleccionar;
    public OpcionesManejoRutina(MIDletGymManager interfaz)
    {
        super("Workouts editor");
        setCommandListener(this);
        principal = interfaz;
        seleccionar = new Command("Select", Command.SCREEN, 0);
        addCommand(seleccionar);
        opciones = new ChoiceGroup("Editor Options", List.EXCLUSIVE);

        opciones.append("Create workout", null);
        opciones.append("Edit workout", null);
        opciones.append("Delete workout", null);
        opciones.setSelectedIndex(0, true);
        append(opciones);




    }

    public void commandAction(Command c, Displayable d)
    {
        int index = opciones.getSelectedIndex();
        String param = opciones.getString(index);
        if (d == this)
        {
            if (param.equals("Create workout"))
            {
                principal.mostrarAgregarRutina();
            }
            else if (param.equals("Edit workout"))
            {
                principal.mostrarListaRutinasEdicion();
            }
            else if (param.equals("Delete workout"))
            {
                principal.mostrarListaRutinasEliminar();
            }
        }
    }

}
